package com.agu.mgt.code.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.agu.utils.Query;

import java.util.List;
import java.util.Map;

import com.agu.mgt.code.dao.CodConfigDao;
import com.agu.entity.code.CodConfigEntity;
import com.agu.mgt.code.service.CodConfigService;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;


@Service("codConfigService")
@Transactional(readOnly = true)
public class CodConfigService{
	@Autowired
	private CodConfigDao codConfigDao;
	
	
	public CodConfigEntity queryObject(Long configId){
		return codConfigDao.queryObject(configId);
	}
	
	
	public List<CodConfigEntity> queryList(Map<String, Object> map){
		return codConfigDao.queryList(map);
	}

    
	public Page<CodConfigEntity> queryPageList(Query query){
	    PageHelper.startPage(query.getPage(), query.getLimit());
	    return codConfigDao.queryPageList(query);
	}
	
	
	public int queryTotal(Map<String, Object> map){
		return codConfigDao.queryTotal(map);
	}
	
	
	@Transactional
	public void save(CodConfigEntity codConfig){
		codConfigDao.save(codConfig);
	}
	
	
	@Transactional
	public void update(CodConfigEntity codConfig){
		codConfigDao.update(codConfig);
	}
	
	
	@Transactional
	public void delete(Long configId){
		codConfigDao.delete(configId);
	}
	
	
	@Transactional
	public void deleteBatch(Long[] configIds){
		codConfigDao.deleteBatch(configIds);
	}
}
